package com.bjpowernode.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ResourceController {

    @PreAuthorize(value = "hasAuthority('user:add')")
    @RequestMapping("/api/add")
    public String add() {
        return "add";
    }

    @PreAuthorize(value = "hasAuthority('user:del')")
    @RequestMapping("/api/del")
    public String del() {
        return "del";
    }

    @PreAuthorize(value = "hasAuthority('user:update')")
    @RequestMapping("/api/update")
    public String update() {
        return "update";
    }

    @PreAuthorize(value = "hasAuthority('user:query')")
    @RequestMapping("/api/query")
    public String query() {
        return "query";
    }
}
